package mj.predictor;
 
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
 
/**
 *
 * @author dirkkoh
 */
public class MahJongSet {
        ArrayList<MahJong> MJSet = new ArrayList<MahJong>();
        public MahJongSet() {
                /*********
                MJID    | MJDesc                | MJType       
                -----------------------------------
                0               | Fei                   | WildCard     
                1               | HongZhong             | ZFB          
                2               | FaChai                | ZFB          
                3               | BaiBan                | ZFB          
                4               | DongFeng              | Wind         
                5               | XiFeng                | Wind         
                6               | NanFeng               | Wind         
                7               | BeiFeng               | Wind         
                8               | YiTong                | Biscuit      
                9               | ErTong                | Biscuit
                10              | SanTong               | Biscuit      
                11              | SiTong                | Biscuit      
                12              | WuTong                | Biscuit      
                13              | LiuTong               | Biscuit      
                14              | QiTong                | Biscuit      
                15              | BaTong                | Biscuit      
                16              | JiuTong               | Biscuit      
                17              | Hua                   | Flower       
                **********/
               
                /*********
                 MJStatus
                 --------
                 Unknown,
                 Discarded,
                 Own,
                 Up,
                 Down,
                 Spotted
                *********/
                for (int i = 0; i < 4; i++) {
                        MJSet.add(new MahJong(0, "Fei", "WildCard", "Unknown"));
                        MJSet.add(new MahJong(1, "HongZhong", "ZFB", "Unknown"));
                        MJSet.add(new MahJong(2, "FaChai", "ZFB", "Unknown"));
                        MJSet.add(new MahJong(3, "BaiBan", "ZFB", "Unknown"));
                        MJSet.add(new MahJong(4, "DongFeng", "Wind", "Unknown"));
                        MJSet.add(new MahJong(5, "XiFeng", "Wind", "Unknown"));
                        MJSet.add(new MahJong(6, "NanFeng", "Wind", "Unknown"));
                        MJSet.add(new MahJong(7, "BeiFeng", "Wind", "Unknown"));
                        MJSet.add(new MahJong(8, "YiTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(9, "ErTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(10, "SanTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(11, "SiTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(12, "WuTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(13, "LiuTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(14, "QiTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(15, "BaTong", "Biscuit", "Unknown"));
                        MJSet.add(new MahJong(16, "JiuTong", "Biscuit", "Unknown"));
                        for (int j = 0; j < 4; j++) {
                        MJSet.add(new MahJong(17, "Hua", "Flower", "Unknown"));
                        }
                }
               
        }
       
        public ArrayList<MahJong> GetMJSet() {
                return MJSet;
        }
       
        public void PrintMJSetDetails() {
                Collections.sort(MJSet);
                for (int i = 0; i < MJSet.size(); i++) {
                        System.out.println((i + 1) + ") " +
                                        MJSet.get(i).GetMJDesc() + " | " +
                                        MJSet.get(i).GetMJType() + " | " +
                                        MJSet.get(i).GetMJStatus());
                }
        }
       
        public void SetKnownMJStatus(String mJDesc, String mJStatus) {
                for (int i = 0; i < MJSet.size(); i++) {
                        if (MJSet.get(i).GetMJDesc() == mJDesc && MJSet.get(i).GetMJStatus() == "Unknown") {
                                MJSet.get(i).SetMJStatus(mJStatus);
                                break;
                        }
                }
        }
}
